﻿using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Super.Hmi.Converters
{
    /// <summary>
    /// 判断用户是否有该按钮的权限
    /// </summary>
    public class PermissionConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var permissionCode = parameter as string;
            return Global.AppContext.Instance.AuthPermissionList.Contains(permissionCode) ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
